<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h1>我是b页面</h1>
    <div class="container"></div>
    <script>
        // console.log(window.location.search);
        var containerEle = document.querySelector(".container");
        var argObj = formatSearch(decodeURI( window.location.search));
        console.log(argObj)
        containerEle.innerHTML = `num1的值是${argObj.num1}num2的值是${argObj.num2}`;

        function formatSearch(str) {
            str = str.substr(1);
            var arr = str.split("&");
            var obj = {};
            arr.forEach(function (item) {
                var newarr = item.split("=");
                obj[newarr[0]] = newarr[1];
            })
            return obj;
        }

    </script>
</body>
</html>